//
//  Esarray.m
//  jiekou
//
//  Created by dllo on 16/08/26
//  Copyright (c) dllo. All rights reserved.
//

#import "Esarray.h"
#import "Album.h"
#import "News.h"

@implementation Esarray


- (void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"album"]) {
        NSMutableArray *albumArr = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            Album *album = [Album modelWithDic:dic];
            [albumArr addObject:album];
        }
        _album = albumArr;
    } else if([key isEqualToString:@"news"]) {
        NSMutableArray *newsArray = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            News *news = [News modelWithDic:dic];
            [newsArray addObject:news];
        }
        _news = newsArray;
    }
    
    
    
}

+ (NSDictionary *)objectClassInArray{
    return @{@"album" : [Album class], @"news" : [News class]};
}

@end
